using System.Collections;
using UnityEngine;

[AddComponentMenu("Scripts/DragTransform")]
public class DragTransform : MonoBehaviour
{
	protected IEnumerator OnMouseDown()
	{
		Vector3 screenSpace = Camera.main.WorldToScreenPoint(base.transform.position);
		Vector3 position = base.transform.position;
		Camera main = Camera.main;
		Vector3 mousePosition = UnityEngine.Input.mousePosition;
		float x = mousePosition.x;
		Vector3 mousePosition2 = UnityEngine.Input.mousePosition;
		Vector3 offset = position - main.ScreenToWorldPoint(new Vector3(x, mousePosition2.y, screenSpace.z));
		while (Input.GetMouseButton(0))
		{
			Vector3 mousePosition3 = UnityEngine.Input.mousePosition;
			float x2 = mousePosition3.x;
			Vector3 mousePosition4 = UnityEngine.Input.mousePosition;
			Vector3 curScreenSpace = new Vector3(x2, mousePosition4.y, screenSpace.z);
			Vector3 curPosition = Camera.main.ScreenToWorldPoint(curScreenSpace) + offset;
			base.transform.position = curPosition;
			yield return 1;
		}
	}
}
